Platform Explorer / Nuxeo Platform 2021.25

Component org.nuxeo.ecm.platform.rendition.service.RenditionService

Documentation

The Rendition Service handles the registered rendition definitions and the rendering of a document based on a rendition definition. It provides an extension point to register rendition definitions.

Resolution Order

454
The resolution order represents the order in which this component has been resolved by the Nuxeo Runtime framework.
You can influence this order by adding "require" tags in your component declaration, to make sure it is resolved after another component.

Start Order

842
The start order represents the order in which this component has been started by the Nuxeo Runtime framework.
This number is interesting to tweak if your Java component interacts with other components, and needs to be started before or after another one.
It can be changed by implementing the method "Component#getApplicationStartedOrder()" on your Java component: components are sorted according to this reference value, in increasing order.
The default value is 1000, and the repository initialization uses number 100. Negative values can also be used.

Implementation

Class: org.nuxeo.ecm.platform.rendition.service.RenditionServiceImpl

Services

Extension Points

Contributions

XML Source

<?xml version="1.0"?>
<component name="org.nuxeo.ecm.platform.rendition.service.RenditionService">

  <documentation>
    The Rendition Service handles the registered rendition definitions and
    the rendering of a document based on a rendition definition.
    It provides an extension point to register rendition definitions.

    @author Thomas Roger (troger@nuxeo.com)
  </documentation>

  <implementation
    class="org.nuxeo.ecm.platform.rendition.service.RenditionServiceImpl" />

  <service>
    <provide interface="org.nuxeo.ecm.platform.rendition.service.RenditionService" />
  </service>

  <extension-point name="renditionDefinitions">
    <documentation>
      Extension point to register rendition definitions.
      For instance, here is one defining a PDF rendition.
      <code>
        <renditionDefinition name="pdf" enabled="true">
          <label>label.rendition.pdf</label>
          <operationChain>blobToPDF</operationChain>
        </renditionDefinition>
      </code>

      Since 6.0:
      <ul>
         <li> a new allowEmptyBlob tag has been added. Setting it's value to true will allow the rendition to be available even if the target Document does not contains a Blob.</li>
         <li> a new visible attribute has been added. Setting it's value to false will allow the rendition to be hidden from the UI services.</li>
      </ul>

    </documentation>
    <object class="org.nuxeo.ecm.platform.rendition.service.RenditionDefinition" />
  </extension-point>

  <extension-point name="renditionDefinitionProviders">
    <documentation>

    </documentation>
    <object class="org.nuxeo.ecm.platform.rendition.service.RenditionDefinitionProviderDescriptor" />
  </extension-point>

  <extension-point name="storedRenditionManagers">
    <documentation>
      Extension point to register a StoredRenditionManager which overrides the DefaultStoredRenditionManager.
    </documentation>
    <object class="org.nuxeo.ecm.platform.rendition.service.StoredRenditionManagerDescriptor" />
  </extension-point>

  <extension-point name="defaultRendition">
    <documentation>
      Defines the default rendition of a given document. Contributions are of the form:
      <code>
        <defaultRendition reason="download">
          <script language="JavaScript">
            function run() {
              if (CurrentUser.getName() != "bob") {
                return null;
              }
              if (!CurrentUser.getGroups().contains("members")) {
                return 'aRenditionName`;
              }
              if (Document.getPropertyValue("dc:format") != "pdf") {
                return 'pdfRendition';
              }
              return 'aDefaultRendition';
          </script>
        </defaultRendition>
      </code>
      The language can be any JVM scripting language, the default is "JavaScript".

      The reason is optional:
       - "download" will be used in the context of bulk download.
       - "publish" will be used to publish the default rendition.

      The script must define a "run()" function that returns a string which is the name of the rendition to be used.
      The method will get called with the following global context (some values may be null):
      Document (DocumentModel) CurrentUser (NuxeoPrincipal), Infos (Map).
    </documentation>
    <object class="org.nuxeo.ecm.platform.rendition.service.DefaultRenditionDescriptor" />
  </extension-point>

  <extension target="org.nuxeo.ecm.core.transientstore.TransientStorageComponent" point="store">
    <!-- Explicit declaration based on default configuration to enforce GC -->
    <store name="LazyRenditionCache" />
  </extension>

</component>